package com.qfedu.scode.vo;

import lombok.Data;

/**
 * @program: StartCoding
 * @description:
 * @author: Feri(邢朋辉)
 * @create: 2021-01-05 11:18
 */
@Data
public class R {
    private int code;
    private String msg;
    private Object data;
    public R(){}

    public R(int code, String msg, Object data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }
    public static R setR(int c,String m,Object o){
        return new R(c,m,o);
    }
    /**
     * 成功*/
    public static R ok(){
        return  setR(1,"OK",null);
    }
    /**
     * 成功 返回数据*/
    public static R ok(Object obj){
        return  setR(1,"OK",obj);
    }
    /**
     * 失败*/
    public static R fail(){
        return setR(2,"FAIL",null);
    }
    /**
     * 失败 返回内容*/
    public static R fail(String m){
        return setR(2,m,null);
    }
}
